#version 150

uniform sampler2D DiffuseSampler;
uniform sampler2D DiffuseDepthSampler;

in vec2 texCoord;
in vec2 oneTexel;
out vec4 fragColor;

void main() {
    vec3 FOG_COLOR = vec3(235.0,245.0,245.0)/255.0;

    vec4 color = texture(DiffuseSampler, texCoord);
    float depth_fog = 1.0-(1.0-texture(DiffuseDepthSampler, texCoord).r)*500.0;
    fragColor = vec4(color.rgb, 1.0);
    if(depth_fog<0.0)depth_fog = 0.0;
    fragColor = vec4(mix(color.rgb , FOG_COLOR, depth_fog), 1.0);
}
